//
//  UIFont+Extension.swift
//  YangFoundation
//
//  Created by yuyang on 2021/12/21.
//

import UIKit

public extension UIFont {

    enum YangFontType: String {
        case pingFangSCLight        =   "PingFangSC-Light"
        case pingFangSCMedium       =   "PingFangSC-Medium"
        case pingFangSCRegular      =   "PingFangSC-Regular"
        case pingFangSCSemibold     =   "PingFangSC-Semibold"
        case pingFangSCThin         =   "PingFangSC-Thin"
        case pingFangSCUltralight   =   "PingFangSC-Ultralight"

        case pingFangTCLight        =   "PingFangTC-Light"
        case pingFangTCMedium       =   "PingFangTC-Medium"
        case pingFangTCRegular      =   "PingFangTC-Regular"
        case pingFangTCSemibold     =   "PingFangTC-Semibold"
        case pingFangTCThin         =   "PingFangTC-Thin"
        case pingFangTCUltralight   =   "PingFangTC-Ultralight"
    }

    /// font
    /// - Parameters:
    ///   - type: font类型
    ///   - size: font大小
    /// - Returns: UIFont
    static func font(type: YangFontType, size: CGFloat) -> UIFont {
        return UIFont(name: type.rawValue, size: size) ?? UIFont.systemFont(ofSize: size)
    }
}
